package com.cnhis.cloudhealth.clinical.clidoctor.visitdoctorparameter.bo;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.cnhis.cloudhealth.clinical.clidoctor.visitdoctorparameter.dao.VisitDoctorParameterDao;
import com.cnhis.cloudhealth.commons.Mappers.ModelVo;
import com.cnhis.cloudhealth.commons.utils.Page;
import com.cnhis.cloudhealth.commons.utils.StaticKeys;

@Service
public class VisitDoctorParameterBo {
	@Resource
  private VisitDoctorParameterDao parametersDao;
	
	public ModelVo queryPhysicianOffice(Map map) throws Exception{
		ModelVo mo = new ModelVo();
		List list = null;
		try {
		  list = parametersDao.queryPhysicianOffice(map);
		} catch (Exception e) {
			mo.setResult(StaticKeys.OH_FALSE);
			return mo;
		}
		
		mo.setList(list);
		mo.setResult(StaticKeys.OH_SUCCESS);
		
		mo.setRows(list);
		return mo;
	}
	public ModelVo queryClinicalDoctor(Map map, int currentPage,int pageSize) throws Exception{
		ModelVo mo = new ModelVo();
		Page pg = null;
		try {
		pg = parametersDao.queryClinicalDoctor(map, currentPage, pageSize);
		} catch (Exception e) {
			mo.setResult(StaticKeys.OH_FALSE);
			return mo;
		}
		
		mo.setList(pg.getList());
		mo.setResult(StaticKeys.OH_SUCCESS);
		mo.setTotal(pg.getTotalNumber());
		mo.setRows(pg.getList());
		return mo;
	}
	
	public ModelVo clinicalReceptionRegion()throws Exception{
		ModelVo mo = new ModelVo();
		List list = null;
		try {
		  list = parametersDao.clinicalReceptionRegion();
		} catch (Exception e) {
			mo.setResult(StaticKeys.OH_FALSE);
			return mo;
		}
		
		mo.setList(list);
		mo.setResult(StaticKeys.OH_SUCCESS);
		
		mo.setRows(list);
		return mo;
	}
	
	public ModelVo autoAddItem()throws Exception{
		ModelVo mo = new ModelVo();
		List list = null;
		try {
		  list = parametersDao.autoAddItem();
		} catch (Exception e) {
			mo.setResult(StaticKeys.OH_FALSE);
			return mo;
		}
		
		mo.setList(list);
		mo.setResult(StaticKeys.OH_SUCCESS);
		
		mo.setRows(list);
		return mo;
	}
	public ModelVo checkPatientVisitDoctorTime(Map map)throws Exception{
		ModelVo mo = new ModelVo();
		List list = null;
		try {
		  list = parametersDao.checkPatientVisitDoctorTime(map);
		} catch (Exception e) {
			mo.setResult(StaticKeys.OH_FALSE);
			return mo;
		}
		
		mo.setList(list);
		mo.setResult(StaticKeys.OH_SUCCESS);
		
		mo.setRows(list);
		return mo;
	}
}
